home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / mkmsgsrc.zip / MKDOS.PAS < prev    next >
Pascal/Delphi Source File  |  1992-09-19  |  2KB  |  102 lines

  1. Unit MKDos;
  2. {$I MKB.Def}
  3.  
  4. Interface
  5.  
  6.  
  7. Function GetDosDate: LongInt;
  8. Function GetDOW: Word;
  9. Function GetResultCode: Integer;
  10. Function TimeOut(Time:LongInt):Boolean; {If time is later than current time
  11.   in timerticks}
  12.  
  13. Var
  14.   TimeCounter: LongInt Absolute $40:$6C;
  15.  
  16.  
  17.  
  18. Implementation
  19.  
  20.  
  21. Uses
  22.   {$IFDEF WINDOWS}
  23.   WinDos;
  24.   {$ELSE}
  25.   Dos;
  26.   {$ENDIF}
  27.  
  28.  
  29. Function TimeOut(Time:LongInt):Boolean;
  30.   Var
  31.     TimeDiff: LongInt;
  32.  
  33.   Begin
  34.   TimeDiff := Time - TimeCounter;
  35.   If TimeDiff < 0 Then
  36.     TimeOut := True
  37.   Else
  38.     Begin
  39.     If (TimeDiff > 780000) Then
  40.     Dec(TimeDiff, 1572480);
  41.     If TimeDiff < 0 Then
  42.       TimeOut := True
  43.     Else
  44.       TimeOut := False;
  45.     End;
  46.   End;
  47.  
  48.  
  49.  
  50. Function GetResultCode: Integer;
  51.   Var
  52.     {$IFDEF WINDOWS}
  53.     Regs: TRegisters;
  54.     {$ELSE}
  55.     Regs: Registers;
  56.     {$ENDIF}
  57.  
  58.   Begin
  59.   Regs.Ah := $4d;
  60.   Intr($21, Regs);
  61.   If Regs.Ah = 0 Then
  62.     GetResultCode := Regs.Al
  63.   Else
  64.     GetResultCode := -Regs.Ah;
  65.   End;
  66.  
  67.  
  68. Function GetDosDate: LongInt;
  69.   Var
  70.     {$IFDEF WINDOWS}
  71.     DT: TDateTime;
  72.     {$ELSE}
  73.     DT: DateTime;
  74.     {$ENDIF}
  75.     DosDate: LongInt;
  76.     DOW: Word;
  77.  
  78.   Begin
  79.   GetDate(DT.Year, DT.Month, DT.Day, DOW);
  80.   GetTime(DT.Hour, DT.Min, DT.Sec, DOW);
  81.   PackTime(DT, DosDate);
  82.   GetDosDate := DosDate;
  83.   End;
  84.  
  85.  
  86. Function GetDOW: Word;
  87.   Var
  88.     {$IFDEF WINDOWS}
  89.     DT: TDateTime;
  90.     {$ELSE}
  91.     DT: DateTime;
  92.     {$ENDIF}
  93.     DOW: Word;
  94.  
  95.   Begin
  96.   GetDate(DT.Year, DT.Month, DT.Day, DOW);
  97.   GetDOW := DOW;
  98.   End;
  99.  
  100.  
  101. End.
  102.